#! /usr/bin/python

import time

start = time.time()

total = [1, 2, 13] 
#'O', 'A', 'L'

length = 0

change = [0 for i in range(7)]
change[2] = 1
change[3] = 1
change[0] = 1 
for length in range(1, 30):
  new = [0 for i in range(7)]
  for i in range(7):
      if i == 0: 
	 new[1] += change[i]
	 new[2] += change[i]
	 new[3] += change[i]

      if i == 1:
	 new[2] += change[i]
	 new[3] += change[i]

      if i == 2:
         new[0] += change[i]
	 new[2] += change[i]
	 new[3] += change[i]

      if i == 3:	 
	 new[4] += change[i]
	 new[6] += change[i]

      if i == 4:
	 new[5] += change[i]
	 new[6] += change[i] 

      if i == 5:
	 new[6] += change[i]

      if i == 6:
	 new[4] += change[i]
	 new[6] += change[i]
  change = new  

print sum(change)
print change
print time.time() - start


